#include <stdio.h>
#define Max 100
int count(char mstr[], char sstr[])
{	   	 	   	   
    int i, j, k, n = 0;
    for (i = 0; mstr[i] != '\0'; i++)
    {	   	 	   	   
        j = i;
        k = 0;
        while (sstr[k] == mstr[j] && mstr[j] != '\0')
        {	   	 	   	   
            j++;
            k++;
        }
        if (sstr[k] == '\0')
            n++;
    }
    return n;
}	   	 	   	   

int main()
{	   	 	   	   
    int n;
    char mstr[Max], sstr[Max];
    printf("请输入主串:");
    scanf("%s", mstr);
    printf("请输入要查找的串:");
    scanf("%s", sstr);
    printf("%s,%s:", mstr, sstr);
    n = count(mstr, sstr);
    if (n > 0)
    {	   	 	   	   
        printf("子串出现的次数：%d\n", n);
    }
    else
        printf("子串不在主串中\n");

}	   	 	   